package com.yidiandao.business.data.push;

import android.content.Context;
import android.text.TextUtils;

import com.yidiandao.business.data.bean.Message;
import com.yidiandao.business.data.push.process.ActivityPushProcess;
import com.yidiandao.business.data.push.process.ArticlePushProcess;
import com.yidiandao.business.data.push.process.CouponPushProcess;
import com.yidiandao.business.data.push.process.DefaultPushProcess;
import com.yidiandao.business.data.push.process.ActivityOrderPushProcess;
import com.yidiandao.business.data.push.process.OfferPushProcess;
import com.yidiandao.business.data.push.process.OrderAgentPushProcess;
import com.yidiandao.business.data.push.process.OrderPushProcess;
import com.yidiandao.business.data.push.process.RedPacketPushProcess;
import com.yidiandao.business.data.push.process.SystemPushProcess;

/**
 * 具体的推送处理类的Factory
 */
public class PushProcessFactory {

    public AbsPushProcess getPushProcess(Context context, Message message, String type, boolean isForeground) {
        AbsPushProcess pushProgress = null;

        if (TextUtils.isEmpty(type)) {
            return new DefaultPushProcess(context, message, isForeground);
        }
        switch (type) {
            // 系统通知
            case Message.Type.SYSTEM:
                pushProgress = new SystemPushProcess(context, message, isForeground);
                break;
            // 物流通知或者订单未支付通知
            case Message.Type.ORDER:
            case Message.Type.ORDER_PAY:
                pushProgress = new OrderPushProcess(context, message, isForeground);
                break;
            // 代理商订单推送
            case Message.Type.ORDER_AGENT:
                pushProgress = new OrderAgentPushProcess(context, message, isForeground);
                break;
            // 活动推送
            case Message.Type.ACTIVITY:
                pushProgress = new ActivityPushProcess(context, message, isForeground);
                break;
            case Message.Type.ACTIVITY_ORDER:
                pushProgress = new ActivityOrderPushProcess(context, message, isForeground);
                break;
            case Message.Type.ARTICLE:
                pushProgress = new ArticlePushProcess(context, message, isForeground);
                break;
            case Message.Type.RED_PACKET:
                // 红包推送
                pushProgress = new RedPacketPushProcess(context, message, isForeground);
                break;
            case Message.Type.BONUS:
                // 优惠券推送
                pushProgress = new CouponPushProcess(context, message, isForeground);
                break;
            case Message.Type.OFFER:
                // 求购详情
                pushProgress = new OfferPushProcess(context, message, isForeground);
                break;
        }

        return pushProgress;
    }
}
